<template>
  <div class="messSty">
    <div>
      <el-input placeholder="请输入用户名" v-model="mes.name" v-focus>
        <template slot="prepend">用户名:</template>
      </el-input>
    </div>
    <br />
	<div>
	  <el-input placeholder="请输入地址" v-model="mes.nativePlace" v-focus>
	    <template slot="prepend">地址:</template>
	  </el-input>
	</div>
	<br />
	<div>
	  <el-input placeholder="请输入学校" v-model="mes.college" v-focus>
	    <template slot="prepend">学校:</template>
	  </el-input>
	</div>
	<br />
    <div>
      <el-input placeholder="请输入手机号" v-model="mes.phoneNumber">
        <template slot="prepend">手机号:</template>
      </el-input>
    </div>
    <br />
	<div>
	  <el-input placeholder="请输入邮箱" v-model="mes.email" @keyup.enter.native="sign">
	    <template slot="prepend">邮箱:</template>
	  </el-input>
	</div>
	<br />
    <div>
      <el-input placeholder="请设置密码" v-model="mes.passWord"  @keyup.enter.native="sign">
        <template slot="prepend">设置密码:</template>
      </el-input>
    </div>
    <br />
    <div>
      <el-input placeholder="请确认密码" v-model="npassword"  @keyup.enter.native="sign">
        <template slot="prepend">确认密码:</template>
      </el-input>
    </div>
    <br />

    <el-row style="padding-top:10px">
      <el-button type="primary" @click="sign" style="width: 100%"
        >注册</el-button
      >
    </el-row>
  </div>
</template>

<script>
// import loginMixin from '../../mixin/loginMixin'
export default {
    name:'sign',
    // mixins:[loginMixin],
    data(){
        return{
            mes:{
                name:'',
                passWord:'',
                nativePlace:"",
				college:"",
				phoneNumber:"",
				email:""
            },
			npassword:""
        }
    },
    methods:{
        sign(){
          if(this.mes.name!=''){
            if(this.mes.phoneNumber!=''){
              if(this.mes.passWord!=''){
                if(this.npassword!=''){
                  if(this.mes.passWord===this.npassword){
                    // 发送注册账号请求
					this.$axios({
					  method: "post",
					  url: "/RegisterStudentUser",
					  data:JSON.stringify(this.mes),
					  headers: {"Content-Type": "application/json" },
					}).then((res) => {
						if(res.data.code=200){
							this.$notify({
								title: '成功',
								message: '请继续操作',
								type: 'success'
							});
							//路由跳转
							this.$router.push({
								name: "userLogin",
							});
						}
					  }).catch((e) => {
					    console.log(e);
					  });
                    
                  }else{
                    alert('两次输入密码不相同')
                  }
                  
                }else{
                  alert('确认密码不能为空')
                }
              }else{
                alert('密码不能为空')
              }
            }else{
              alert('不能为空')
            }
          }else{
            alert('不能为空')
          }
        }
    },
    
}
</script>

<style>

</style>